<div class="breadcrumbwidget">
	<ul class="skins">
        <li><a href="default" class="skin-color default"></a></li>
        <li><a href="orange" class="skin-color orange"></a></li>
        <li>&nbsp;</li>
        <li class="fixed"><a href="" class="skin-layout fixed"></a></li>
        <li class="wide"><a href="" class="skin-layout wide"></a></li>
    </ul><!--skins-->
	<ul class="breadcrumb">
        <li><a href="<?php echo $baseurl?>">Trang chủ</a> <span class="divider">/</span></li>
        <li class="active">Quản lý chương trình</li>
    </ul>
</div><!--breadcrumbwidget-->
<div class="pagetitle">
	<h1>Thông tin danh sách câu hỏi</h1> <span></span>
</div>
<div class="maincontent">
    <div class="contentinner content-dashboard">
    
        <a class="btn btn-primary" target="_blank" href="<?php echo $baseurl.'manage/question/add-question/'.$id?>">Thêm câu hỏi</a><br /><br />
    
        <table class="table table-bordered">
        <colgroup>
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
            <col class="con1" />
            <col class="con0" />
        </colgroup>
        <thead>
            <tr>
            	<th class="centeralign"><input type="checkbox" class="checkall" /></th>
                <th>STT</th>
                <th>Câu hỏi</th>
                <th>Chương trình</th>
                <th></th>
            </tr>
        </thead>
        <tbody>
        <?php if(!in_array($data, array(null, '', '0'))):?>
            <?php foreach($data AS $key=>$value): ?>
                <tr>
                	<td class="centeralign"><input type="checkbox" /></td>
                    <td><?php echo $value['stt']; ?></td>
                    <td><?php echo json_decode($value['content'])->question; ?></td>
                    <td><?php echo $value['campaign']; ?></td>
                    <td class="centeralign">
                        <a href="<?php echo $baseurl.'manage/question/edit/'.$value['id']?>"><i class="icon-pencil"></i></a>
                        <a href="#del-<?php echo $value['id']?>" class="deleterow-x"><i class="icon-trash"></i></a>
                    </td>
                </tr>
            <?php endforeach;?>
            </tbody>
        </table>

        <?php else: ?>
            </tbody>
        </table>
        <?php endif;?>
    
    </div>
</div>
<script>

jQuery('.deleterow-x').click(function(){
    var ids = $(this).attr('href').replace("#del-", "");
	var conf = confirm('Thao tác này sẽ xóa câu hỏi. Bạn chắc chắn?');
	if(conf)
		jQuery(this).parents('tr').fadeOut(function(){
			jQuery(this).remove();
			$.ajax({
                type: "GET",
			    url: baseUrl+'manage/question/delete',
                data: ({id : ids})
			});
		});
	return false;
});
</script>